<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /**
     * 构造函数命名：单词首字母均为大写
     * this指代实例对象
     * new:创建一个空对象，用this指代这个空对象/return返回
    */
    function CreateMovie(movieName, type, rate, showTime){
        this.movieName = movieName;
        this.type = type;
        this.rate = rate;
        this.showTime = showTime;
        this.getNextShowing = function(){
            var current = 10;
            for(var i = 0;i < this.showTime.length; i++){
                var timer = parseInt(this.showTime[i]);
                if(current < timer){
                    console.log(this.movieName +"下一次的播放时间" + this.showTime[i]);
                    break;
                }
            }
        }
        return this;
    }
    //对象的实例化：需要使用关键字new
    var movie1 = new CreateMovie("007","谍战","9.0",["12:00","14:00","16:00"]);
    movie1.getNextShowing();
    var movie2 = new CreateMovie("指环王","冒险","9.2",["13:00","15:00","17:00"]);
    console.log(movie1);
    console.log(movie2);
</script>
</html>